// scaup - Scala up!
// *** DRAFT ***
// (c) 2008-2010, Normen Müller, normen.mueller@gmail.com  
// $Id: diff.scala 52 2010-01-13 08:00:28Z normen.mueller $
package scalaxx.draft.diff

import scala.xml._

trait Model[-I] {
  type T >: I
  def eqc(symbol: T): Equiv[T] = new Equiv[T] {def equiv(x: T,y: T): Boolean = x == y}
}
class XMLModel extends Model[Node] {
  
}

trait Differ[I] extends ((I,I) => Patcher[I])
trait SDiffer[Model[I],I] extends Differ[I]
trait Patcher[I] extends (I => I)

object diff {
  def apply(l: String,r: String) = (new GNUDiffer)(l,r)
}
object sdiff {
  def apply(m: Model[Node],l: Node,r: Node) = (new XMLDiffer)(l,r)
}
object patch {
  def apply[T](p: Patcher[T],l: T) = p(l)
}

class GNUDiffer extends Differ[String] {
  def apply(l: String,r: String): GNUPatcher = error("")
}
class GNUPatcher extends Patcher[String] {
  def apply(l: String): String = error("")
}

class XMLDiffer extends Differ[Node] {
  def apply(l: Node,r: Node): XMLPatcher = error("")
}
class XMLPatcher extends Patcher[Node] {
  def apply(l: Node): Node = error("")
}

object eq_name extends Equiv[Node] {
  def apply(x: Node,y: Node): Boolean = equiv(x,y)
  def equiv(x: Node,y: Node): Boolean = x.label == y.label
}
object eq_deep extends Equiv[Node] {
  def apply(x: Node,y: Node): Boolean = equiv(x,y)
  def equiv(x: Node,y: Node): Boolean = x == y
}

object Test {
  def main(args: Array[String]): Unit = {
    patch(diff("A","B"),"A")
    
    sdiff(new XMLModel, <a/>, <a/>)
  }
}
